package com.jmemoir.safe.paramsencrypt.controller;

import com.jmemoir.common.dto.Result;
import com.jmemoir.safe.paramsencrypt.dto.PageEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 测试控制层
 *
 * @author Tellsea
 * @date 2023/8/6
 */
@Slf4j
@RestController
@RequestMapping("/paramEncryptTest")
public class ParamsEncryptTestController {

    @GetMapping("/testGet")
    public Result<String> testGet() {
        return Result.success("测试 GET 无参方法");
    }

    @GetMapping("/testGet1")
    public Result<Long> testGet1(@RequestParam("id") Long id) {
        return Result.success("测试 GET 一个参数的方法", id);
    }

    @GetMapping("/testGet2")
    public Result<PageEntity> testGet2(PageEntity entity) {
        return Result.success("测试 GET 参数为对象", entity);
    }

    @GetMapping("/testGet3/{id}")
    public Result<Long> testGet3(@PathVariable("id") Long id) {
        return Result.success("测试 GET Restful 风格参数", id);
    }

    @GetMapping("/testPost")
    public Result<String> testPost() {
        return Result.success("测试 POST 无参方法");
    }

    @GetMapping("/testPost1")
    public Result<Long> testPost1(@RequestParam("id") Long id) {
        return Result.success("测试 POST 一个参数的方法", id);
    }

    @GetMapping("/testPost2")
    public Result<PageEntity> testPost2(PageEntity entity) {
        return Result.success("测试 POST 参数为对象", entity);
    }

    @GetMapping("/testPost3/{id}")
    public Result<Long> testPost3(@PathVariable("id") Long id) {
        return Result.success("测试 POST Restful 风格参数", id);
    }
}
